<template>
	<v-chart :option="chartOptions" autoresize style="height: 300px;" />
</template>

<script setup>
import { computed } from 'vue'
import VChart from 'vue-echarts'
import * as echarts from 'echarts'

const props = defineProps({ data: Object })

const chartOptions = computed(() => ({
	title: { text: '能耗趋势对比' },
	tooltip: { trigger: 'axis' },
	legend: { data: ['本日', '昨日'] },
	xAxis: { type: 'category', data: props.data?.labels || [] },
	yAxis: { type: 'value' },
	series: [
		{ name: '本日', type: 'line', smooth: true, data: props.data?.seriesA || [] },
		{ name: '昨日', type: 'line', smooth: true, data: props.data?.seriesB || [] }
	]
}))
</script>
